//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<IPass.h>
///	@path	~/src/graphics/
///	@date	2007/10/31
///	@desc	Render pass interface.

#pragma once

#include "xeres.h"

#include "graphics/IDevice.h"
#include "graphics/RenderContext.h"
#include "graphics/IView.h"

namespace xeres {

	// pass state

#define	PASS_PRIMARY		(1<<0)
#define	PASS_SHADOW			(1<<1)
#define	PASS_REFLECTION		(1<<2)
#define	PASS_OCCLUSION		(1<<3)
#define	PASS_IRRADIANCE		(1<<4)

	/*!
		\struct	PassState
		\brief	Provide pass states for presentation to determine render in pass or not.

		\sa IPass
	*/
	struct PassState
	{
		// pass type
		uchar		m_passType;

		// pass name (id)
		uchar		m_passName;

		// pass additional info
		// LightId in shadow mode
		// BoxId in reflection mode
		ushort		m_passInfo;
	};

	/*!
		\class	IPass
		\brief	Render pass interface.

		\sa IRenderer
	*/
	class IPass : public IObject
	{
	public:

		/// \name Constructor & Destructor
		//@{

		/// \ctor
		IPass( void );

		/// \dtor
		virtual ~IPass( void );

		DECL_IOBJECT_INTERFACE( IPass , IObject );

		//@}

	public:

		/// \name IPass Interface
		//@{

		/*!
			\brief		Initialize render pass.
		*/
		virtual void Initialize( RefWeak<IDevice> device ) = 0;

		/*!
			\brief		Finalize render pass.
		*/
		virtual void Finalize( void ) = 0;

		/*!
			\brief		Begin to draw current pass.
		*/
		virtual void Begin( RenderContext& rc ) = 0;

		/*!
			\brief		End current pass.
		*/
		virtual void End( RenderContext& rc ) = 0;

		/*! 
			\brief		Set pass view.
		*/
		virtual void SetPassView( RefWeak<IView> view ) = 0;

		/*! 
			\brief		Get pass view.
		*/
		virtual RefWeak<IView> GetPassView( void ) = 0;

		//@}
	};

} // namespace xeres
